/**
 * 
 */
package niuke.toutiao;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class t1 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner = new Scanner(System.in);
		int n = scanner.nextInt();
		int k = scanner.nextInt() - 1;
		int[] a = new int[n];
		for (int i = 0; i < a.length; i++) {
			a[i] = scanner.nextInt();
		}
		scanner.close();
		a[k]--;
		a[(k - 1 + n) % n]++;
		for (int i = 0; i < a.length; i++) {
			if (i != n - 1) {
				System.out.print(a[i] + " ");
			} else {
				System.out.println(a[i]);
			}
		}
	}

}
